<!DOCTYPE html>
<html lang="zh_CN">
	<head>
		<meta charset="UTF-8">
		<title>文章编辑</title>
		<link rel="stylesheet" href="./static/css/bootstrap4.0.min.css" >
		<script src="./static/js/jquery.slim.min.js" ></script>
		<script src="./static/js/popper.min.js" ></script>
		<script src="./static/js/bootstrap4.0.min.js"></script>
		<script src="./static/js/wangEditor.min.js"></script>

		<style>
			.w-e-text-container {
				height: 200px !important;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<form action="/jsp/admin/article/edit/do" method="post">
				<input type="hidden" value="1" name="id" />
				<div class="form-group">
					<label for="title">文章标题</label>
					<input type="text" class="form-control" id="title" name="title" placeholder="文章标题" value="示例文章标题">
				</div>
				<div class="form-group">
					<label for="keywords">关键字</label>
					<input type="text" class="form-control" id="keywords" name="keywords" placeholder="关键字" value="关键字示例">
				</div>
				<div class="form-group">
					<label for="div1">内容</label>
					<div id="div1">
						<p>这里是文章内容示例。</p>
						<p>你可以在这里编辑内容。</p>
					</div>
					<textarea id="content" name="content" style="display: none"></textarea>
				</div>
				<div align="center">
					<button type="submit" style="margin-bottom: 100px; background-color: #AB82FF">
						发表
					</button>
				</div>
			</form>
		</div>
		
		
		<script>
			document.addEventListener("DOMContentLoaded", function() {
				// 初始化 wangEditor
				var E = window.wangEditor;
				var editor = new E('#div1');
				var $text1 = document.getElementById('content');

				editor.config.onchange = function (newHtml) {
					$text1.value = newHtml;
				};

				editor.create();
				editor.txt.html(document.getElementById('div1').innerHTML);
			});
		</script>
	</body>
</html>